home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Review 28
/
Creative-Review-CD-ROM-28.iso
/
mac
/
kungfu
/
assets
/
game.dir
/
00012_Script_fling manager class
< prev
next >
Wrap
Text File
|
1997-08-08
|
4KB
|
168 lines
-- fling manager class class
-- --------------------------------------------------
property list
property animlist
property channels
property hitchannels
property freechannels
property max
property ducks
-- ==================================================
global gcallback, ggame, gplayer, gsound
-- ==================================================
-- new method
-- --------------------------------------------------
on new me, props
minit me, props
return me
end mnew
-- ==================================================
-- minit method
-- --------------------------------------------------
on minit me, props
-- put "in minit fling manager"
set numochannels = 4
set lochannel = 3
set channels = []
repeat with channel = ( lochannel ) to ( lochannel + numochannels - 1 )
add channels, channel
end repeat
set freechannels = duplicate ( channels )
set hitchannels = [ 20 , 21 ]
set animlist = data2list ( "fling anim data" )
set ducks = data2list ( "ducks data" )
set list = []
set max = 4
-- put "out minit fling manager"
end minit
-- ==================================================
-- mmake method
-- --------------------------------------------------
on mmake me, props
-- put "in mmake fling manager"
if count ( list ) >= max and count ( freechannels ) then return
set data = getaprop ( props, #data )
set direction = getaprop ( props, #direction )
set anims = getaprop ( animlist, data )
set animdata = getaprop ( anims, direction )
setaprop props, #animdata, animdata
set move = getaprop ( props, #move )
set thismovesducks = getaprop ( ducks, move )
setaprop props, #ducks, thismovesducks
set thechannel = getat ( freechannels, 1 )
deleteat ( freechannels, 1 )
setaprop ( props, #channel, thechannel )
set fling = new ( script "fling class" , props )
add list, fling
mstart fling
set madecount = madecount + 1
-- put "out mmake fling manager"
end mmake me
-- ==================================================
-- mreturnthedead method
-- --------------------------------------------------
on mreturnthedead me, thedead
-- put "in mreturnthedead fling manager"
add freechannels, the channel of thedead
deleteone list , thedead
-- put freechannels
-- put "out mreturnthedead fling manager"
end mreturnthedead
-- ==================================================
-- mhit method
-- --------------------------------------------------
on mhit me, data , actualloc, animname
-- put "in mhit fling manager"
set props = [:]
set anims = getaprop ( animlist, data )
set props = getaprop ( anims, animname )
set hitanim = new ( script "anim class" , props )
set thechannel = getat ( hitchannels, 1 )
deleteat hitchannels, 1
append hitchannels, thechannel
set props = [:]
setaprop props, #channel, thechannel
setaprop props, #loc, actualloc
set draw = new ( script "draw class" , props )
msetdraw hitanim, [ draw ]
mstart hitanim, me
add list, hitanim
-- put "out mhit fling manager"
end mhit me
-- ==================================================
-- manimfinish method
-- --------------------------------------------------
on manimfinish me, hitanim
-- put "in manimfinish fling manager"
mhide hitanim
deleteone list, hitanim
-- put "out manimfinish fling manager"
end manimfinish me
-- ==================================================
-- mshow method
-- --------------------------------------------------
on mshow me
-- put "in mshow fling manager class"
-- put "out mshow fling manager class"
end mshow